﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layouts/List.Master" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="AddOrganizationProcessUser.aspx.cs" Inherits="Bingosoft.WebApp.Modules.SecurityConsole.Organization.AddOrganizationProcessUser" %>
<%@ Import Namespace="Bingosoft.Modules.SecurityConsole.Common.Helper" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<web:Script ID="Script1" src="~/Modules/SecurityConsole/Common/FunctionControl/TreeListSelect/TreeListSelectObject.js" runat="server" />
<web:Script ID="Script4" src="~/Modules/SecurityConsole/Common/FunctionControl/ListSelect/ListSelectControl.js" runat="server" />
<web:Script ID="Script2" src="~/Modules/SecurityConsole/Common/FunctionControl/CategorySelect/CategorySelectControl.js" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
<script type="text/javascript">
    var Global = {};
    Global.contextPath = '<%= RequestHelper.GetContextPath(Request) %>';
</script>
<div class="datalist">
<div id="roleUser" style="margin-top:10px;" runat="server">
    <h2 style="height:30px;">
    【<asp:Label ID="labUser" runat="server" Text="Label"></asp:Label>】
    </h2>
	        <div class="toolbar"  style="height:30px;">
            <span>
                <asp:Button ID="btnAddUser" Text="添加用户" runat="server" OnClientClick="return addUser()" onclick="btnAddUser_Click"/>
            </span>
	        </div>
            <web:SmartGridView ID="gvRoleUser" DataSourceID="SmartSqlDataSource2" 
                runat="server" AutoGenerateColumns="false" Width="100%" DataKeyNames="Id" 
                AllowPaging="true" EmptyDataText="暂无数据">
                <Columns>
                    <asp:BoundField DataField="Name" SortExpression="Name" HeaderText="用户名称" />
                    <asp:BoundField DataField="LoginId" SortExpression="LoginId" HeaderText="登录账号" />
                    <asp:TemplateField HeaderText="操作"  ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                                <asp:ImageButton ID="roleUserDelete" runat="server" ToolTip="移除" ImageUrl="~/Images/ico_del.gif" _UserId='<%#Eval("Id") %>' _KeyId='<%#Eval("WfRoleId")%>'
                                    CausesValidation="False" OnClientClick="return window.confirm('您确认要移除该用户吗?')" OnClick="RoleUserDelete">
                                </asp:ImageButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </web:SmartGridView>
            <web:SmartSqlDataSource ID="SmartSqlDataSource2" runat="server" SelectCommandAutoPageWrap="true" DefaultSortExpression="Id asc"></web:SmartSqlDataSource>
        </div>
        </div>
        <input type="hidden" runat="server" id="ReturnIds" />
        <script type="text/javascript" language="javascript">
            var RoleId = '<%=Request.QueryString["Id"]%>';
            function addUser() {
              var treeListSelect = new TreeListSelect();
              treeListSelect.setTreeRootSqlId("organization.firstFloor.tree");
              treeListSelect.setTreeChildSqlId("organization.getChildren");
              treeListSelect.setTitle("组织机构");
              treeListSelect.setTreeAsyn("true");
              treeListSelect.setTreeRootText("组织机构");
              treeListSelect.setTreeRootId("root");
              treeListSelect.setListSqlId("role.userSelect.user_list");
              treeListSelect.setParams("ROLE_ID:" + RoleId);
              var returnValue = treeListSelect.show(Global.contextPath);
              if (returnValue && returnValue.length == 2) {
                  document.getElementById("<%= ReturnIds.ClientID %>").value = returnValue[0];
                  return true;
              }
              return false;
          }
          </script>
</asp:Content>
